package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.dto.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author WFan
 * @since 2025-03-27
 */
@Api(tags = "互动问题回答或评论管理")
@RestController
@RequestMapping("/replies")
@RequiredArgsConstructor
public class InteractionReplyController {

    private final IInteractionReplyService interactionReplyService;

    /**
     * 新增回答或评论
     * @param replyDTO
     */
    @PostMapping
    @ApiOperation("保存互动回答或评论")
    public void saveReply(@RequestBody ReplyDTO replyDTO) {
        interactionReplyService.saveReply(replyDTO);
    }

    /**
     * 分页查询互动回答或评论列表
     * @param query
     * @return
     */
    @GetMapping("/page")
    @ApiOperation("分页查询互动回答或评论列表")
    public PageDTO<ReplyVO> queryReplyPageList(ReplyPageQuery query) {
        return interactionReplyService.queryReplyPageList(query);
    }
}
